<?php 

if (!count($this->rowset)) {
	$colspan = count($this->columns) + 2;
	echo "<tr><td colspan='$colspan'><h3>Ничего не найдено, попробуйте уменьшить критерии поиска.</h3></td></tr>";
	return ;
}

foreach ($this->rowset as $row) {
	echo '<tr>';
	echo "<td>{$row['id']}</td>";
	foreach ($this->columns as $column => $label) {
		$value = $row[$column];
		echo "<td>$value</td>";
	}
	
	if ($row['crud_locked']) {
		echo "<td class='is_locked'>Редактируется ({$row['crud_locked']})</td>";
	} else {
		$editUrl = $this->url(array('table' => $this->request['table'], 'action' => 'edit', 'id' => $row['id']));
		$deleteUrl = $this->url(array('table' => $this->request['table'], 'action' => 'delete', 'id' => $row['id']));
		
		$action = $this->acl['update'] ? "<a class='edit' href='$editUrl'>Изменить</a>" : '';
		if ($this->acl['delete']) {
			if ($action) $action .= ' | ';
			$action .=  "<a class='delete' href='$deleteUrl'>Удалить</a>";
		}
	
		if (!$action) $action = "&nbsp;";
		echo "<td>$action</td>";
	}
	
	echo '</tr>';
}
